Socket
Socket
Sign inDemoInstall

rx-lite

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rx-lite

Lightweight library for composing asynchronous and event-based operations in JavaScript


Version published
Weekly downloads
1.7M
increased by4.32%
Maintainers
1
Weekly downloads
 
Created

What is rx-lite?

The rx-lite npm package is a lightweight version of RxJS, which provides a core set of functionality for reactive programming with observables. It allows developers to compose asynchronous and event-based programs using observable sequences.

What are rx-lite's main functionalities?

Creating Observables

This feature allows the creation of observables. Observables are data streams that can emit multiple values over time, and they are the core abstraction in RxJS.

var Rx = require('rx-lite');

var observable = Rx.Observable.create(function (observer) {
  observer.onNext('Hello, World!');
  observer.onCompleted();
});

observable.subscribe(function (x) {
  console.log(x);
});

Transforming Data Streams

This feature demonstrates the 'map' operator, which transforms each item emitted by an observable by applying a function to it.

var Rx = require('rx-lite');

var source = Rx.Observable.range(1, 5);
var mapped = source.map(function (x) { return x * x; });

mapped.subscribe(function (x) {
  console.log(x);
});

Filtering Data Streams

This feature shows the 'filter' operator, which emits only those items from an observable that pass a predicate test.

var Rx = require('rx-lite');

var source = Rx.Observable.from([1, 2, 3, 4, 5]);
var filtered = source.filter(function (x) { return x % 2 === 0; });

filtered.subscribe(function (x) {
  console.log(x);
});

Combining Multiple Streams

This feature illustrates how to combine multiple observables into one observable sequence using the 'concat' operator.

var Rx = require('rx-lite');

var stream1 = Rx.Observable.of('Hello');
var stream2 = Rx.Observable.of('World');
var combined = Rx.Observable.concat(stream1, stream2);

combined.subscribe(function (x) {
  console.log(x);
});

Other packages similar to rx-lite

Keywords

FAQs

Package last updated on 11 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc